feat(review): dispatch revision-aware reviews by exact head - #36
Conversation
📝 WalkthroughWalkthroughThe changes add durable review-head SHA handling to reusable workflows, introduce control-plane manual review requests for interaction commands, support workflow-dispatch event parsing, and make T0 orchestration retry leases and abort provider execution when the review revision changes. ChangesRevision-aware review flow
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8).github/workflows/reviewrouter-execution-reusable.ymlTraceback (most recent call last): .github/workflows/reviewrouter-reusable.ymlTraceback (most recent call last): Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/reviewrouter-execution-reusable.yml:
- Around line 220-228: Align the T0 checkout step named “Checkout exact T0
review revision” with the runtime input’s SHA precedence: use the same resolved
commit value for both checkout ref and runtime validation/input, preferring the
live pull request head SHA when operating on a live PR and otherwise using
inputs.review_head_sha. Preserve exact-head consistency so checkout and runtime
never target different revisions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 025299b7-a843-47eb-8b77-29dd6eddbaac
⛔ Files ignored due to path filters (2)
dist/index.jsis excluded by!**/dist/**dist/index.js.mapis excluded by!**/dist/**,!**/*.map
📒 Files selected for processing (11)
.github/workflows/reviewrouter-execution-reusable.yml.github/workflows/reviewrouter-reusable.yml__tests__/unit/codex-oauth/action-mode.test.ts__tests__/unit/control-plane/review-request.test.ts__tests__/unit/github/interaction.test.ts__tests__/unit/review-orchestration/run-t0-review-orchestration.test.tssrc/codex-oauth/action.tssrc/control-plane/review-request.tssrc/github/interaction.tssrc/main.tssrc/review-orchestration/application/run-t0-review-orchestration.ts
| - name: Checkout exact T0 review revision | ||
| if: ${{ inputs.review_action_lane == 't0' && steps.runtime.outputs.can_run == 'true' }} | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ inputs.review_head_sha }} | ||
| persist-credentials: false | ||
|
|
||
| - name: Checkout pull request code | ||
| if: ${{ steps.runtime.outputs.can_run == 'true' }} | ||
| if: ${{ inputs.review_action_lane == 'legacy' && steps.runtime.outputs.can_run == 'true' }} |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect how review_head_sha is supplied by callers of the reusable workflows.
rg -nP -C3 'review_head_sha' .github/workflowsRepository: 777genius/review-router
Length of output: 5584
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== relevant files =="
git ls-files .github/workflows/reviewrouter-execution-reusable.yml .github/workflows/reviewrouter-reusable.yml
echo
echo "== reviewer execution workflow outline/context =="
wc -l .github/workflows/reviewrouter-execution-reusable.yml
sed -n '1,90p' .github/workflows/reviewrouter-execution-reusable.yml
sed -n '200,240p' .github/workflows/reviewrouter-execution-reusable.yml
sed -n '320,345p' .github/workflows/reviewrouter-execution-reusable.yml
echo
echo "== reusable workflow inputs and runtime env =="
sed -n '1,60p' .github/workflows/reviewrouter-reusable.yml
sed -n '90,130p' .github/workflows/reviewrouter-reusable.yml
sed -n '140,190p' .github/workflows/reviewrouter-reusable.yml
echo
echo "== usages of reviewer execution workflow in repo (text diff context) =="
python3 - <<'PY'
from pathlib import Path
import re
for p in sorted(Path('.github').rglob('*.yml')) + sorted(Path('.github').rglob('*.yaml')):
b = p.read_text(errors='ignore')
if 'reviewrouter-execution-reusable.yml' in b:
lines=b.splitlines()
print(f'--- {p} ---')
for i,l in enumerate(lines,1):
if 'reviewrouter-execution-reusable.yml' in l or 'review_head_sha' in l:
a=max(1,i-4); z=min(len(lines),i+4)
for j in range(a,z+1):
print(f'{j:4}: {lines[j-1]}')
print()
PYRepository: 777genius/review-router
Length of output: 16319
Use the same SHA for the T0 checkout and runtime input.
The T0 tree is checked out at inputs.review_head_sha, but the runtime input prefers the live github.event.pull_request.head.sha. If a PR advances after the T0 workflow is queued, inputs.review_head_sha stays at the older durable value while the runtime can receive/validate the newer head, breaking the exact-head durability guarantee. Align the checkout ref with the runtime input precedence, or pass github.event.pull_request.head.sha to both when operating on a live PR.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/reviewrouter-execution-reusable.yml around lines 220 -
228, Align the T0 checkout step named “Checkout exact T0 review revision” with
the runtime input’s SHA precedence: use the same resolved commit value for both
checkout ref and runtime validation/input, preferring the live pull request head
SHA when operating on a live PR and otherwise using inputs.review_head_sha.
Preserve exact-head consistency so checkout and runtime never target different
revisions.
Summary
Verification
Summary by CodeRabbit
New Features
/rr reviewcommand for requesting a manual review.Bug Fixes